home *** CD-ROM | disk | FTP | other *** search
- G4C
-
- ; dir.search gui
-
- ; this gui will take the files you have chosen in dir.gc and load them
- ; into a file list. You can then search this file list for any string.
- ; the results will be displayed in an other lv.
-
-
- WinBig -1 -1 400 145 'Getting Files'
- WinType 11110001
- varpath 'dir.gc'
-
- Box 0 0 0 0 out button
-
-
- xOnLoad
- sc_ci = ''
- sc.mode = FIL
- sc_flg = ''
- if $$lv.id > ''
- sc_id = $$lv.id
- else
- sc_id = 1
- endif
- sc_dir = $$LV.DIR
- gosub dir.search startup
- run 'resident guis:c/fsearch pure add'
-
- xOnReload ; cause if lvmulti finds an error it will stop
- if $$lv.id > ''
- sc_id = $$lv.id
- else
- sc_id = 1
- endif
- sc_dir = $$LV.DIR
- gosub dir.search startup ; and gui will remain loaded
-
- xroutine startup
- setscreen dir.search $*SCREEN
- setscreen dir.Gauge $*SCREEN
- setgad dir.search 4 hide
- sc.filecount = 0
- lvuse dir.gc $sc_id
- lvmulti first
- if $lv_file = ""
- ezreq "How's about choosing\nsome files first ?" 'Oh yeah..' ""
- stop
- endif
- while $lv_file > ""
- counter sc.filecount inc 1
- lvuse dir.search 3
- lvadd $lv_file
- lvuse dir.gc $sc_id
- lvmulti next
- endwhile
- setwintitle dir.search 'Enter substring to search for:'
- guiopen dir.search
- setgad dir.search 2 ON
-
-
- xOnOpen
- while $lv_file > ""
- lvuse dir.search 3
- lvadd $lv_file
- lvuse dir.gc $sc_id
- lvmulti next
- endwhile
- setwintitle dir.search 'Enter substring to search for:'
- setgad dir.search 2 ON
-
- xOnClose
- guiquit dir.search
-
- xOnQuit
- delvar .search
- guiquit dir.Gauge
- run 'resident fsearch remove'
-
- xOnFail
- update dir.search 2 '*** Error during search ***'
- guiwindow dir.search resume
-
-
- ; ----------------------- gui handler
-
- xroutine makegui
- if $sc.mode = RES
- setgad dir.search 3 hide
- setgad dir.search 4 show
- setgad dir.search 11 hide
- else
- setgad dir.search 3 show
- setgad dir.search 4 hide
- setgad dir.search 11 show ; reload
- endif
- redraw dir.search
-
- ;========================= Gadgets
-
- xCycler 5 20 120 13 '' sc_ci
- cstr "Same Case" ''
- cstr "Ignore Case" I
-
- xCycler 125 20 120 13 '' sc_flg
- cstr 'Verbose' ''
- cstr 'FLAG & NUM' 'FLAG NUM'
- cstr 'FLAG files' 'FLAG'
- cstr 'Line NUMbers' 'NUM'
-
- xcycler 300 20 95 13 '' sc.mode ; change listviews etc
- gadid 6
- cstr Files FIL
- cstr Results RES
- gosub dir.search makegui
-
- xbutton 250 20 50 13 Rld
- gadid 11
- if $$lv.id > ''
- sc_id = $$lv.id
- else
- sc_id = 1
- endif
- sc_dir = $$LV.DIR
- LVUSE dir.search 3
- lvchange ''
- gosub dir.search startup
-
-
- ;-------------------------------- the listviews
-
- xlistview 5 35 390 114 "" sc_file "" 10 TXT ; files list
- GADID 3
- cutvar sc_file cut word 1 sc_name
- ifexists file $sc_name
- lv_file = $sc_name
- guiopen dir.g2
- endif
-
-
- xlistview 5 35 390 114 "" sc_file "" 10 TXT ; results
- GADID 4
- cutvar sc_file cut word 1 sc_name
- ifexists file $sc_name
- cutvar sc_file cut word 1 sc_line
- if $sc_line < 1
- delvar sc_line
- endif
- lv_file = $sc_name
- guiopen dir.g2
- endif
-
- ; ------------------------ TEXT-IN + LAUNCH SEARCH
-
- xTextIn 5 2 390 16 "" sc_string "" 130
- gadid 2
- delete ram:t/search
- lvuse dir.search 3
- lvgo #0
- sc_file = $$lv.rec
- guiopen dir.Gauge
- guiwindow dir.search wait
- sc.count = 0
- while $sc.count < $$lv.total
- sc.percent == $sc.count * 100
- sc.percent == $sc.percent / $sc.filecount
- update dir.Gauge 1 $sc.percent
- lvgo #$sc.count
- sc_file = $$lv.rec
- action cli $sc_file 'fsearch >>ram:t/search $$file \"$sc_string\" $sc_ci $sc_flg'
- counter sc.count inc 1
- endwhile
- lvuse dir.search 4
- lvchange ram:t/search
- guiwindow dir.search resume
- guiclose dir.Gauge
- setwintitle dir.search 'Search finished - Click on filename wanted'
- if $sc.mode = FIL
- sc.mode = RES
- update dir.search 6 1
- gosub dir.search makegui
- endif
-
-
- ;=====================
-
- newfile dir.Gauge
-
- winbig -1 -1 400 20 ''
- wintype 00001000
-
- Gauge 0 0 0 0 out icondrop 3 0 0
- gadid 1
-
-
-